package com.cycle.community.entity;

import lombok.Data;

import java.util.HashMap;
import java.util.Map;

/**
 * @author lenovo
 * @create 2022/8/17 20:14
 */
@Data
public class Event {
    //张三给李四点赞
    private String topic;
    private long userId;
    private int entityType;//张三
    private long entityId;
    private long entityUserId;//实体作者//通知李四
    private Map<String, Object> data = new HashMap<>();//内容实在不够用map封装

    //为了构造对象方便
    public Event setEntityId(long entityId) {
        this.entityId = entityId;
        return this;
    }

    public Event setTopic(String topic) {
        this.topic = topic;
        return this;
    }

    public Event setUserId(long userId) {
        this.userId = userId;
        return this;
    }

    public Event setEntityType(int entityType) {
        this.entityType = entityType;
        return this;
    }

    public Event setEntityUserId(long entityUserId) {
        this.entityUserId = entityUserId;
        return this;
    }

    //    public Event setData(Map<String, Object> data) {
    public Event setData(String key, Object value) {
        this.data.put(key, value);
        return this;
    }
}
